﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

namespace Ue.Infrastructure.Data
{
    public interface IRepository<TEntity,TKey>
        where TEntity : IEntity<TKey>
    {
        IQueryable<TEntity> Table { get; }

        TEntity this[TKey key] { get; set; }

        void Add(TEntity entity);
        void Remove(TEntity entity);
        
        bool ContainsKey(TKey key);
        bool Contains(TEntity entity);

        TEntity FindBy(TKey key);
        IEnumerable<TEntity> FindBy(Expression<Func<TEntity, bool>> predicate);
        IEnumerable<TEntity> FindBy(Expression<Func<TEntity, bool>> predicate,int skip,int count);

        int Count(Expression<Func<TEntity, bool>> predicate);
    }
}
